//
//  MyBooksCell.m
//  TeacherPro
//
//  Created by DCQ on 2018/5/28.
//  Copyright © 2018年 ZNXZ. All rights reserved.
//

#import "MyBooksCell.h"
#import "PublicDocuments.h"
#import "ProUtils.h"
#import "HomeListModel.h"
#import "UIImageView+WebCache.h"
@interface MyBooksCell()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *iconImgV;
@property (weak, nonatomic) IBOutlet UIImageView *addImgV;

@end
@implementation MyBooksCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.titleLabel.font = fontSize_12;
    self.titleLabel.textColor = UIColorFromRGB(0x6b6b6b);
    [self.titleLabel sizeToFit];
//    NSString * bookName = @"英语(人教社)";
//    NSString * gradeName = @"六年级下册";
//    NSString * newline = @"\n";
//    NSString * tempStr = [bookName stringByAppendingString:newline];
//     tempStr = [tempStr stringByAppendingString:gradeName];
//    NSRange gradeRange = [tempStr rangeOfString:gradeName];
//    UIColor * gradeColor = UIColorFromRGB(0x6b6b6b);
//    UIFont  * gradFont = fontSize_12;
//    self.titleLabel.attributedText = [ProUtils setAttributedText:tempStr withColor:gradeColor withRange:gradeRange withFont:gradFont];
    
    self.iconImgV.layer.shadowOpacity = 0.4;// 阴影透明度
    
    self.iconImgV.layer.shadowColor = [UIColor grayColor].CGColor;// 阴影的颜色
    
    self.iconImgV.layer.shadowRadius = 5;// 阴影扩散的范围控制
    
    self.iconImgV.layer.shadowOffset  = CGSizeMake(1, 1);// 阴影的范围
}
- (void)setupBookData:(id)bookModel{
    
     HomeBooksModel * model = bookModel;
     UIImage * placeholderImg = [UIImage imageNamed:BooksPlaceholderImgName];
     self.titleLabel.text = model.name;
    [self.iconImgV sd_setImageWithURL:[NSURL URLWithString:model.coverImage] placeholderImage:placeholderImg];
    self.addImgV.hidden = YES;
    [ProUtils changeLineSpaceForLabel:self.titleLabel WithSpace:UILABEL_LINE_SPACE];
    
    
}
- (void)setupAddBookUI{
    
    [self.iconImgV setImage:[UIImage imageNamed:@"home_shuben_add_bg.png"]];
    self.titleLabel.text = @"添加书籍";
    self.addImgV.hidden = NO;
}
@end
